const getters = {
	// visitedViews: state => state.tagsView.visitedViews,
	// activeView: state => state.tagsView.activeView,
	device: state => state.app.device,
	theme: state => state.app.theme,
	avatar: state => state.user.avatar || '/img/logo.a5a6223c.png',
	nickname: state => state.user.name,
	welcome: state => state.user.welcome,
	roles: state => state.user.roles,
	userId: state => state.user.userId,
	userInfo: state => state.user.info,
	addRouters: state => state.permission.addRouters,
	multiTab: state => state.app.multiTab,
	contentWidth: state => state.app.contentWidth,
	fixedHeader: state => state.app.fixedHeader,
	fixedSidebar: state => state.app.fixedSidebar,
	primaryColor: state => state.app.primaryColor,
	getBindDeptTree(state) {
		return function(orgId) {
			if (state.deptTree && state.deptTree.length > 0) {
				if (!orgId) {
					console.log('state.deptTree', state.deptTree)
					return state.deptTree;
				} else {
					let tree = state.deptTree.filter(item => item.orgId == orgId);
					return tree;
				}

			}
			return [];
		}
	},
	onEvent(state) {
		return function(method) {
			let index = state.websockStore.eventlist.map((eb) => {
				return eb.method
			}).indexOf(method);
			if (state.websockStore.eventlist.length > 0 && index >= 0) {
				let result = Object.assign({}, state.websockStore.eventlist[index]);
				state.websockStore.eventlist.splice(index, 1);
				console.log("事件" + JSON.stringify(result.data))
				return result.data;
			}
			return null;
		}
	},
	topicType(state) {
		return state.tempTestData.topicType
	}
}

export default getters